package com.hyl.springbootsecurity.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * LoginController
 *
 * @author hyl
 * @date 2025-01-10
 */
@Controller
public class LoginController {
    @GetMapping("/tologin")
    public String toLogin() {
        return "login";
    }

    @PostMapping("/doLogin")
    public String login() {
        System.out.println(" 执行登 录方法");
        return "main";
    }

    // 负责登录成功后跳转到主页面
    @RequestMapping("/toMain")
    public String toMain() {
        return "main";
    }

    // 负责登录失败后跳转到失败页面
    @RequestMapping("/toError")
    public String toError() {
        return "error";
    }


}
